package top.zackyoung.springboot.controller;

import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import top.zackyoung.springboot.entity.JavaUser;
import top.zackyoung.springboot.service.JavaUserService;

import javax.annotation.Resource;

/**
 * @author ZackYoung
 * @version 1.0
 * @description
 * @date 2021/5/15 23:15
 */
@RestController
public class JavaController {
    @Resource
    JavaUserService javaUserService;

    @RequestMapping("/java/test/{id}")
    public String javaTest(@PathVariable("id") String id) {
        return "java id is" + id;
    }

    @RequestMapping("/java/get/{id}")
    public JavaUser getId(@PathVariable("id") Long id) {
        return javaUserService.getById(id).get();
    }
    @RequestMapping("/java/get2/{id}")
    public JavaUser get2Id(@PathVariable("id") Long id) {
        return javaUserService.getByIdMP(id).get();
    }
}
